<template>
    <div class="parent">
        <div class="child">
            <amisComponent :formjson="formjson"></amisComponent>
        </div>
    </div>
</template>
<script setup lang="ts">
defineOptions({
    name: 'amis'
})
import maintenance from '@/api/modules/maintenance'
import amisComponent from '../component/amis.vue'
import defaultConfig from '@/config'

const router = useRouter()

const formjson = ref({})

onMounted(async () => {
    try {
        const { path } = router.currentRoute.value
        maintenance.devTools.getPageSchema.url = defaultConfig.API_URL + path
        const res = await maintenance.devTools.getPageSchema.get()
        formjson.value = JSON.parse(res.data)
    } catch (error) {
        console.error('Schema获取失败:', error)
        formjson.value = {}
    }
})
</script>
<style scoped>
.parent {
    position: relative;
    height: 100%; /* 父容器需有明确高度 */
}
</style>
